import request from "@/utils/request";

//  获取所有角色列表
export function settingGetListApi(params) {
  return request({
    url: "/sys/role",
    params
  });
}

//添加角色 /sys/role
export function settingAddRoleApi(data) {
  return request({
    url: "/sys/role",
    method: "POST",
    data: data
  });
}

//修改角色 /sys/role
export function settingUpdateRoleApi(data) {
  return request({
    url: `/sys/role/${data.id}`,
    method: "put",
    data
  });
}

//  根据ID获取角色详情
export function settingRoleRightsApi(id) {
  return request({
    url: `/sys/role/${id}`
  });
}

//  根据ID获取角色详情
export function settingRoleDelApi(id) {
  return request({
    url: `/sys/role/${id}`,
    method: "DELETE"
  });
}

//  给角色进行授权
export function settingRoleToRightsApi(data) {
  return request({
    url: `/sys/role/assignPrem`,
    method: "PUT",
    data
  });
}
